/**
 * 
 */
package com.acc.softmgr.common.genertor.gen;

import java.util.Date;

import org.apache.velocity.VelocityContext;

import com.acc.softmgr.common.genertor.utils.CodeResourceUtil;
import com.acc.softmgr.common.genertor.utils.CommUtil;
import com.acc.softmgr.common.genertor.utils.PageParserUtil;

/**
 * 
 * @content 生成实体
 * 
 * @date 2017年5月20日
 * 
 * @author OprCalf
 * 
 */
public class GenerateEntity extends BaseGenerate {

	public static void genEntity(String tableName, String pckPath, String beanPath) {
		String className = CommUtil.formatTableNameToClassName(tableName);
		VelocityContext context = new VelocityContext();
		context.put("basePackage", CodeResourceUtil.basePackage);
		context.put("createDate", new Date());
		context.put("className", className);
		try {
			context.put("feilds", createBean.getBeanFeilds(tableName));
		} catch (Exception e) {
			e.printStackTrace();
		}
		PageParserUtil.WriterPage(context, "EntityTemplate.ftl", pckPath, beanPath);
	}

}
